package com.connectlinkcorp.common.ui.demo;



import com.connectlinkcorp.common.ui.scorecounter.ScoreCounter;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ScoreCounterActivity extends Activity implements OnClickListener{
	
	protected static int imageScore[] = new int[]{
		R.drawable.scoredigit0,R.drawable.scoredigit1,R.drawable.scoredigit2,R.drawable.scoredigit3,
		R.drawable.scoredigit4,R.drawable.scoredigit5,R.drawable.scoredigit6,R.drawable.scoredigit7,
		R.drawable.scoredigit8,R.drawable.scoredigit9
	};
	
	private ScoreCounter numberTileView;
	private EditText editFrom;
	private EditText editTo;
	private Button btnStart;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_scorecounter);
		
		numberTileView = (ScoreCounter)findViewById(R.id.numberTileView);
		editFrom = (EditText)findViewById(R.id.editFrom);
		editTo = (EditText)findViewById(R.id.editTo);
		btnStart = (Button)findViewById(R.id.btnStart);
		btnStart.setOnClickListener(this);
		
		
		// set up param
		numberTileView.setUpParam(this,300,0,0,100,100,200,100);
		// show number
		numberTileView.show();
		// set resource background for digit
		numberTileView.setImageScore(imageScore);
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		try {
			int fromScore = Integer.parseInt(editFrom.getText().toString());
			int toScore = Integer.parseInt(editTo.getText().toString());
			// start
			numberTileView.start(fromScore,toScore);
		} catch (Exception e) {
			
		}
		
	}

}





















